package gravitationally_adjustable_physical_ball;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;

public class ApplicationMain extends JFrame{
    private static final long serialVersionUID = 1L;
    private AppPanel panel=new AppPanel();
    private DataShower dataShower=new DataShower(panel);
    private Running ballRunning=new Running(panel.getBall(),panel,10);
//  private ColorAdjuster_deprecated ballColor=new ColorAdjuster_deprecated();
    private Container mainScreen;
    public ApplicationMain() {
        mainScreen=this.getContentPane();
        mainScreen.setLayout(new BorderLayout());
        mainScreen.add(panel,BorderLayout.CENTER);
        mainScreen.add(dataShower,BorderLayout.NORTH);
//      mainScreen.add(ballColor,BorderLayout.EAST);
        pack();
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setTitle("可调节重力小球JAVA重制版");
        try {
            Image icon= ImageIO.read(ApplicationMain.class.getResource("images/icon2.png"));
            setIconImage(icon);
        } catch (Exception e) {
            System.out.println("Not found target image.");
            System.out.println("图标加载失败，使用默认图标");
        }
        setResizable(false);
        setVisible(true);
        repaint();
        ballRunning.start();
    }
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable(){
            @Override
            public void run(){
                new ApplicationMain();
            }
        });
    }
}
//灵感是我几年前的一个Scratch作品“可调节重力小球”。小球还是那个小球，增删了一些功能。